<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="format-detection" content="telephone=no">
        <title>闲置</title>

        <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>

        <link rel="stylesheet" href="./Public/bootstrap/bootstrap.css">
        <link rel="stylesheet" href="./Public/awesome/font-awesome.min.css">
        <link rel="stylesheet" href="./Public/frozenui/css/frozen.css">

        <link rel="stylesheet" href="./Public/css/index.css">

        <script src="./Public/json2.js"></script>
        <script src="./Public/timeFormat.js"></script>
        <script src="./Public/jquery.min.js"></script>
        <script src="./Public/jquery.session.js"></script>
        <!-- <script src="https://cdn.bootcss.com/hammer.js/2.0.8/hammer.min.js"></script> -->
        <script src="./Public/bootstrap/bootstrap.min.js"></script>
        <script src="https://cdn1.lncld.net/static/js/av-min-1.5.0.js"></script>
        <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
        <script type="text/javascript">
            wx.config({
                debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                appId: 'wxf20953cc201449dd', // 必填，公众号的唯一标识
                timestamp: '{$Think.session.timestamp}', // 必填，生成签名的时间戳
                nonceStr: '{$Think.session.nonceStr}', // 必填，生成签名的随机串
                signature: '{$signature}',// 必填，签名，见附录1
                jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
            });
            wx.ready(function(){
                wx.onMenuShareTimeline({
                    title: '卖闲置，上开麦', // 分享标题
                    link: 'http://www.kmic168.com/?m=web&a=goods', // 分享链接
                    desc: '主持人闲置物品买卖',
                    imgUrl: 'http://www.kmic168.com/Public/img/logo.jpg', // 分享图标
                    success: function () { 
                        // 用户确认分享后执行的回调函数
                    },
                    cancel: function () { 
                        // 用户取消分享后执行的回调函数
                    },
                    trigger: function (res) {
                    //alert("分享到朋友圈按钮点击");        
                    },
                    fail: function (res) {
                    //alert(JSON.stringify(res));
                    }
                });
                
                wx.onMenuShareAppMessage({
                   title: '卖闲置，上开麦', // 分享标题
                    link: 'http://www.kmic168.com/?m=web&a=goods', // 分享链接
                    desc: '主持人闲置物品买卖',
                    imgUrl: 'http://www.kmic168.com/Public/img/logo.jpg', // 分享图标
                    type: 'link', // 分享类型,music、video或link，不填默认为link
                    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                    success: function () { 
                        // 用户确认分享后执行的回调函数
                    },
                    cancel: function () { 
                        // 用户取消分享后执行的回调函数
                    }
                });
            });
        </script>

    </head>
    <body ontouchstart=""><input type="hidden" name="openid" value="{$Think.session.openid}"> 
        
        <!-- header -->
        <header class="detail-header">
            <div class="artist-close"></div>
            <div class="header-title">
                <p>闲置</p>
            </div>
            <div class="filter">
                
                <div class="filter-content">
                    <header class="detail-header">
                        <div class="back">
                        </div>
                        <div class="header-title">
                            <p>筛选</p>
                        </div>
                        <div class="filter-close">
                            
                        </div>
                    </header>
                    <section class="filter-menu">
                        <ul class="filter-list">
                            <li class="size filter-item">
                                <p>尺码</p>
                                <ul>
                                    <li>S码</li>
                                    <li>M码</li>
                                    <li>L码</li>
                                    <li>均码</li>
                                    <li>不限</li>
                                </ul>
                            </li>
                            <li class="goods-price filter-item">
                                <p>{$Think.lang.L_PRICE}</p>
                                <ul>
                                    <li>100以下</li>
                                    <li>100~300</li>
                                    <li>300以上</li>
                                </ul>
                            </li>
                            <li class="goods-new filter-item">
                                <p>新旧程度</p>
                                <ul>
                                    <li>全新</li>
                                    <li>9成新及以上</li>
                                    <li>8-9成新</li>
                                    <li>偏旧</li>
                                    <li>不限</li>
                                </ul>
                            </li>
                            <li class="filter-btn filter-item clearfix">
                                <a class="reset" href="javascript:;">重置</a>
                                <a class="confirm" href="javascript:;">确定</a>
                            </li>
                        </ul>
                    </section>
                </div>
                
            </div>
        </header>
        

        <div class="f_windown">
            <div class="bg"></div>
            <div class="ui-scroller">
                <div id="f_close"><img src="./Public/Kmic/close.png" width="30"/></div>
                <div class="f_close_line"></div>
                <div class="windown-info">
                    <p>报名成功</p>
                    <p>已把您的资料投递到商家，请耐心等候恢复</p>
                    <a href="">确定</a>
                </div>
            </div>
        </div> 

        <div class="f_windown1">
            <div class="bg"></div>
            <div class="ui-scroller">
                <div id="f_close1"><img src="./Public/Kmic/close.png" width="30"/></div>
                <div class="f_close_line"></div>
                <div class="windown-info">
                    <p>您的报价 (单位/元)</p>
                    <input name="price" type="text" placeholder="输入价钱 / 元" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')" >
                    <a class="sent" href="javascript:;">立即报名</a>
                </div>
            </div>
        </div> 

        <!-- main -->
        <section class="announce-menu">

            <!-- announce -->
            <ul class="ui-list list goods-list">
            </ul>
            

            <!-- loading -->

            <div class="ui-loading-block show">
                <div class="ui-loading-cnt">
                    <i class="ui-loading-bright"></i>
                    <p>正在加载中...</p>
                </div>
            </div>

        </section>

        <!-- footer -->
        <footer id="footer">
            <ul>
                <li><a href="?m=web&c=index&openid={$Think.get.openid}"><i></i>通告</a></li>
                <li><a href="?m=web&c=index&a=artist&openid={$Think.get.openid}"><i></i>主持人</a></li>
                <li class="current"><a href="?m=web&c=index&a=goods&openid={$Think.get.openid}"><i></i>闲置</a></li>
                <li><a href="?m=Center&c=Profile&a=index&openid={$Think.get.openid}"><i></i>我</a></li>
            </ul>
        </footer>

        <!-- 发物品 -->
        <div class="newGoods">
            <a href="javascript:newGoods('{$Think.get.openid}');"></a> 
        </div>  

        <script src="./Public/js/index.js"></script>  
        
        <script>

            $(window).scroll(function() {
                if ($(document).scrollTop()!=0){
                    sessionStorage.setItem("offsetTop", $(window).scrollTop());//保存滚动位置
                } 
                loaddata();
            });


            $('.show').fadeOut();
            var el;
            var totalheight = 0;     //定义一个总的高度变量
            var isLoading = 0;
            var city = "";
            var province = "";
            var where = new Array();
            var page = 0;
            var isEnd = 0;
            var level = '{$Think.session.level}';
            var openid = '{$Think.session.openid}';
            where['is_show'] = 1;
            
            var back = window.location.href.indexOf('back');

            var uncache = window.location.href.indexOf('uncache');

            if (back != -1 || uncache != -1) {
                page = sessionStorage.getItem("page");
                var _list = sessionStorage.getItem("list");
                var _offset = sessionStorage.getItem("offsetTop");
                getPage();

                $('.list').html(_list);
                $(document).scrollTop(_offset);

            } else {
                getPage();
            }


            function getPage(){
                sessionStorage.setItem("page", parseInt(page)+1);
                var string = "";
                for (value in where){
                    if (where[value] != null) {
                        string += value+'='+where[value]+',';
                        console.log(string);
                    }
                }

                $.ajax({
                    type: 'GET',
                    url: "?m=Web&a=goodsList",
                    data: {'page':page,'where':string},
                    complete:function(result){
                    },

                    success: function(result){
                        $.each(result, function(i,val){
                            console.log(val);
                            var time = getDateDiff(val.modify_time);
                            var size = '';
                            if (val.size == -1) {
                                size = '不限';
                            } else if (val.size == 0) {
                                size = '均码';
                            } else if (val.size == 1) {
                                size = 'S码';
                            } else if (val.size == 2) {
                                size = 'M码';
                            } else if (val.size == 3) {
                                size = 'L码';
                            }

                            var g_new = '';
                            if (val.new == 10) {
                                g_new = '全新';
                            } else if (val.new == 1) {
                                g_new = '偏旧';
                            } else if (val.new == 8) {
                                g_new = '8成新';
                            } else if (val.new == 8.5) {
                                g_new = '8.5成新';
                            } else if (val.new == 9) {
                                g_new = '9成新';
                            } else if (val.new == 9.5) {
                                g_new = '9.5成新';
                            } else {
                                g_new = 0;
                            }

                            var price_h = '';
                            if (val.price_h != null) {
                                if (val.price_h.length >1) {
                                    price_h = "-"+val.price_h;
                                }
                            }
                            var price = ''
                            if (val.price  == -1 || val.price == 0) {
                                price = '自报价格';
                            } else {
                                price = '{$Think.lang.L_CURRENCY_SIGN}'+val.price+price_h;
                            }
                            

                            var strVar_html ='';
                            if (level == '10') {
                                strVar_html ='<div class="lx_button" onclick="deleteData(event,'+val.id+')">删除</div>';
                            }
  
                            var strVar = "";
                            strVar += "<li class=\"goods-list-item\" id=\"l"+val.id+"\" onclick=\"goodsDetails(\'"+openid+"\',\'"+val.id+"\');\">\n";
                            
                            strVar += "<div class=\"goods-info\">\n";
                            strVar += "<div class=\"goods-user\">\n";
                            strVar += "<img class=\"img-circle head-img\" src=\""+ val.headimgurl +"\">\n";
                            strVar += "<div class=\"detail-title-content\">\n";
                            strVar += "<span class=\"artist-name\">"+ val.name +"<\/span>\n";
                            strVar += "<span class=\"goods-time\">"+ time +"<\/span>\n";
                            strVar += "<\/div>\n";
                            strVar += "<\/div>\n";
                            strVar += "<p class=\"goods-item-price\">"+ price +"<\/p>\n";
                            strVar += "<\/div>\n";
                            // str += '<div class="list-menu" onclick="announcementPage(\''+openid+'\',\''+val.id+'\');" >';
                            // str += strVar_html;
                            if (val.exchange_pic) {
                                strVar += "<div class=\"goods-img\">\n";
                                for (var j = 0; j < val.exchange_pic.length; j++) {
                                    strVar += "<img src=\"./Public/img/img_cover.png\" style=\"background: url(\'"+ val.exchange_pic[j].value +"\') no-repeat center/cover;\">\n";
                                    if (j == 2) {
                                        break;
                                    }
                                }
                                strVar += "<\/div>\n";
                            }
                           

                            strVar += "<div class=\"goods-title\">\n";

                            if (g_new != 0) {
                                strVar += "<p class=\"goods-name\">"+ val.title +" (" + g_new + ")<\/p>\n";
                            } else {
                                strVar += "<p class=\"goods-name\">"+ val.title +"<\/p>\n";
                            }
                            
                            strVar += "<p class=\"goods-size\">"+ size +"<\/p><\/div>\n";

                            strVar += "<\/li>";
                            $('.list').append(strVar);

                        });

                        sessionStorage.setItem("list", $('.list').html());
                       
                        $(".list").find("#loading").remove(); 
                        
                        /*if (result.length > 0) {
                            $(".list").append('<li class="ui-border-t" id="loading"><img src="Public/Images/loading.gif" width="50"/></li>');
                        }*/
                        if (result.length == 0){
                            $(".list").append('<li class="ui-border-t" id="loading">没有更多</li>');
                            isEnd = 1;
                        }
                        isLoading = 0;
                        $('.show').fadeOut();
                    },
                    beforeSend: function(){
                        $('.show').fadeIn();

                    },
                    dataType: 'json'
                }); 
            }
                    
        </script>  
        
        <script src="./Public/ga.js"></script>
    </body>
</html>